SKIN_BASE=$(shell basename tinymce_skin_mt_*.zip .zip)
PLUGINS_BASE=$(shell basename tinymce_plugin_movabletype_*.zip .zip)

ja: cleanup extract
	unzip -o -d jscripts/tiny_mce tinymce_lang_pack_ja.zip

all: cleanup extract
	unzip -o -d jscripts/tiny_mce tinymce_lang_pack_all.zip

cleanup:
	rm -fr jscripts

extract: base skin plugins patch
	
base:
	unzip tinymce_3_2*.zip -d tinymce
	mv tinymce/jscripts .
	rm -fr tinymce

skin:
	unzip ${SKIN_BASE}.zip
	mv ${SKIN_BASE}/mt jscripts/tiny_mce/themes/advanced/skins/
	rm -fr ${SKIN_BASE}

plugins:
	unzip ${PLUGINS_BASE}.zip
	mv ${PLUGINS_BASE}/movabletype jscripts/tiny_mce/plugins
	rm -fr ${PLUGINS_BASE}

patch:
	patch -p0 -d jscripts < tinymce_plugins_media_divx_patch.diff
	rm -fr tinymce_plugins_media_divx_patch.diff
